home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #3 / Amiga Plus CD - 2002 - No. 03.iso / AmigaPlus / AmigaOS / Aplus_Dev / AP-Website / links / admin / dupes.php < prev    next >
Encoding:
PHP Script  |  2002-10-28  |  1.7 KB  |  75 lines

  1. <?
  2. // *******************************************************************
  3. //  admin/dupes.php
  4. // *******************************************************************
  5.  
  6. include("../include/config.php");
  7. include("../include/functions.php");
  8. include("../include/lang/$language.php");
  9.  
  10. include("../include/session.php");
  11. session_start();
  12. ?>
  13. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  14. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  15. <html>
  16.     <head>
  17.         <title>Admin</title>
  18.     </head>
  19.     <?=$adm_body?>
  20.     <table cellspacing="5" cellpadding="5" border="1" align="center">
  21.     <tr bgcolor="#dddddd">
  22.         <td> ID </td>
  23.         <td> Site URL </td>
  24.         <td> Edit </td>
  25.         <td> Delete </td>
  26.     </tr><?
  27.     
  28.     $get_dupes = sql_query("
  29.         select
  30.             SiteURL,
  31.             count(*) as count
  32.         from
  33.             $tb_links
  34.         group by
  35.             SiteURL
  36.         order by
  37.             count desc
  38.         limit
  39.             0,1;
  40.     ");
  41.  
  42.     while($dupes = sql_fetch_array($get_dupes)){
  43.         
  44.         if($dupes[count]>1){
  45.             
  46.             $get_sites = sql_query("
  47.                 select
  48.                     *
  49.                 from
  50.                     $tb_links
  51.                 where
  52.                     SiteURL = '$dupes[SiteURL]'
  53.             ");
  54.  
  55.             while($site = sql_fetch_array($get_sites)){
  56.                     
  57.                     echo "<tr bgcolor=\"#eeeeee\">";
  58.                     echo "<td>" . $site[ID] . "</td>";
  59.                     echo "<td>" . $site[SiteURL] . "</td>";
  60.                     echo "<td><a href=\"edit_site.php?" . session_name() . "=";
  61.                     echo session_id() . "&ID=";
  62.                     echo $site[ID] . "&\">Edit</a></td>";
  63.                     echo "<td><a href=\"delete_site.php?" . session_name() . "=";
  64.                     echo session_id() . "&dbtable=links&dupes=1&ID=";
  65.                     echo $site[ID] . "&\">Delete</a></td>";
  66.                     echo "</tr>\n";
  67.             }
  68.         } else {
  69.                 ?><tr><td colspan="4">No Duplicates found.</td></tr><?
  70.         }
  71.     }
  72.     ?></table>
  73. </body>
  74. </html>
  75.